package com.shxy.config

import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.CorsRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration
open class MyWebMvcConfig : WebMvcConfigurer {

    /**
     * 跨域请求
     */
    override fun addCorsMappings(registry: CorsRegistry) {
        registry.addMapping("/")
            .allowedHeaders("*")
            .allowedMethods("*")
            .maxAge(1800)
            .allowedOrigins("http://localhost:80")
    }
}